﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Phoenix.Service.Model" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
编辑新闻
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadScripts" runat="server">
  <script type="text/javascript" src="/Scripts/m-former.js"></script>    
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <% OrganizationModel objOrganization = ViewData["OrganizationModel"] as OrganizationModel;%>
<div class="pd10">
        <form id="form1" method="post" action="save">
        <input type="hidden" id="hdaction" name="hdaction" value="<%=ViewData["Action"] %>" />
        <input type="hidden" id="hdOrgID" name="hdOrgID" value="<%=ViewData["OrgID"] %>" />

        <table class="tb-list mt10">
          <tr>
                <td class="aR">
                   机构路径：
                </td>
                <td class="aL">
                    <%= ViewData["NamePath"] %>
                </td>
            </tr>
            <tr>
                <td class="aR">
                    机构名称：
                </td>
                <td class="aL">
                    <input type="text" name="txtOrgName" id="txtOrgName" value="<%=(objOrganization!=null)?objOrganization.OrgName:"" %>" maxlength="200" style="width: 350px" class="inputStyle" />
                     <span id="spTxtOrgNamee" style="display:none;"></span>
                </td>
            </tr>
            <tr>
                <td class="aR">
                    部门主管ID：
                </td>
                <td class="aL">
                    <input type="text" name="txtLeaderID" id="txtLeaderID" value="<%=(objOrganization!=null)?objOrganization.LeaderID.ToString():"" %>" maxlength="200" style="width: 350px" class="inputStyle" />
                </td>
            </tr>
             <tr>
                <td class="aR">
                    主管姓名：
                </td>
                <td class="aL">
                <input  type="text" name="txtLeaderName" id="txtLeaderName" value="<%=(objOrganization!=null)?objOrganization.LeaderName:"" %>" style="width: 350px" class="inputStyle" />

                </td>
            </tr>
             <tr>
                <td class="aR">
                    办公电话：
                </td>
                <td class="aL">
                <input  type="text" name="txtOfficePhone" id="txtOfficePhone" value="<%=(objOrganization!=null)?objOrganization.OfficePhone:"" %>" style="width: 350px" class="inputStyle" />

                </td>
            </tr>
            <tr>
                <td class="aR">
                    机构地址：
                </td>
                <td class="aL">
                <input  type="text" name="txtAddress" id="txtAddress" value="<%=(objOrganization!=null)?objOrganization.Address:"" %>" style="width: 350px" class="inputStyle" />
                </td>
            </tr>
        </table>
        <div class="aC">
            <input id="subbtn" type="button" value="保存" class="i-btn3"/>
            <input type="button" value="取消" onclick="cancel();" class="i-btn3"/></div>
        </form>
    </div>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="BodyScripts" runat="server">
<script type="text/javascript">
    $("#form1").former({
        submit: 'subbtn',    //提交按钮id
        style: { right: 'icon-right', error: 'icon-error' }, 
        ajax: true,         //开启ajax提交
        url: "/Organization/Save",    //提交url
        //验证规则
        validate: {
            txtOrgNamee: {
                tipElem: 'spTxtOrgNamee',
                rules: [
		                { rule: 'EMPTY', txt: '机构名称不能为空' },
		                { rule: 'LENGTH', min: 0, max: 50, txt: '长度不超过50' }
		            ]
            }
        },
        //ajax提交成功执行
        success: function (data) {
            if (data.status === "warning" || data.status === "error") {
                alert(data.msg);
                return false;
            }
            // 操作成功
            alert(data.msg);
            // 执行回调方法
            successHandle();
        },
        //ajax提交失败执行
        error: function (jqXHR, textStatus, errorThrown) {
            alert('发生了未知错误');
        }
    });

    function cancel() {
        window.top.oDG.cancel();
    };

    /**
    * 弹窗处理
    */
    //窗口回调处理
    function successHandle() {
        window.top.winObj.refresh();
        window.top.oDG.cancel();
    };
</script>
</asp:Content>

